package com.relytosoft.mizar.analyze.base.enums;

import java.util.Objects;

/**
 * @author wss
 * @version 1.0
 * @date 2022/5/23 11:31
 */
public enum PlanTypeEnum {
    WEEK_PLAN(0, "周计划"),
    DAY_PLAN(1, "日计划"),
    ALL_DAY_PLAN(2, "全天计划");

    int value;
    String name;

    PlanTypeEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public static PlanTypeEnum getByValue(Integer value) {
        if (Objects.isNull(value)) {
            return null;
        }

        PlanTypeEnum[] values = PlanTypeEnum.values();
        for (PlanTypeEnum planTypeEnum : values) {
            if (Objects.equals(value, planTypeEnum.getValue())) {
                return planTypeEnum;
            }
        }
        return null;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "PlanTypeEnum{" +
                "value=" + value +
                ", name='" + name + '\'' +
                '}';
    }
}
